#ifndef _ERROR_H
#define _ERROR_H

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ macros                                                            +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

#define FATAL_ERROR();				shutDown(SHUTDOWN_ERROR);
#define FATAL_ERROR1(str);			printf(str);printf("\n");xmlBegin();fprintf(errPtr,str);xmlEnd();shutDown(SHUTDOWN_ERROR);
#define FATAL_ERROR2(str,arg1);		printf(str,arg1);printf("\n");xmlBegin();fprintf(errPtr,str,arg1);xmlEnd();shutDown(SHUTDOWN_ERROR);
#define FATAL_ERROR3(str,arg1,arg2);	printf(str,arg1,arg2);printf("\n");xmlBegin();fprintf(errPtr,str,arg1,arg2);xmlEnd();shutDown(SHUTDOWN_ERROR);

#define ERROR_LVL1(str);				FATAL_ERROR1(str);	
#define ERROR0_LVL2(str);			printf(str);printf("\n");xmlBegin();fprintf(errPtr,str);xmlEnd();
#define ERROR1_LVL2(str,arg1);		printf(str,arg1);printf("\n");xmlBegin();fprintf(errPtr,str,arg1);xmlEnd();
#define ERROR2_LVL2(str,arg1,arg2);	printf(str,arg1,arg2);printf("\n");xmlBegin();fprintf(errPtr,str,arg1,arg2);xmlEnd();

#define FCLOSE(arg);	if(fclose(arg)){ printf("could not close executable file\n"); }

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ private variables                                                 +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

extern FILE *errPtr;
char errFileName[128];

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ private prototypes                                                +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

void xmlBegin(); /* print beginning of XML error message markup*/
void xmlEnd(); /* print end of XML error message markup*/

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ public prototypes                                                 +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

void setUpErrorFile();	
void shutDown(U1 code);

#endif
